import request from '@/utils/request'

export function getFinanceList(query) {
  return request({
    url: 'backe_finance_order_finance_day',
    method: 'get',
    params: query
  })
}

export function getOrderPaymentType(pid) {
  return request({
    url: '/finance/getOrderPaymentType/' + pid,
    method: 'get'
  })
}
export function cancelDay(data) {
  return request({
    url: 'backe_this_daily_cancel',
    method: 'post',
    data
  })
}
export function makeNewOrderSubmit(data) {
  return request({
    url: 'backe_finance_make_new_order',
    method: 'post',
    data
  })
}

export function searchPayment(order_sn, type) {
  return request({
    url: '/finance/searchPayment/' + order_sn + '/' + type,
    method: 'get'
  })
}
// 创建订单
export function createPaymentRecord(data) {
  return request({
    url: '/finance/createPaymentRecord',
    method: 'post',
    data
  })
}

export function deletePaymentRecord(record_id, pay_id) {
  return request({
    url: '/finance/deletePaymentRecord/' + record_id + '/' + pay_id,
    method: 'delete'
  })
}

export function getOrderPaymentMonthList(data) {
  return request({
    url: 'backe_finance_order_payment_month_list',
    method: 'post',
    data
  })
}

export function getOrderPaymentHandDayList(data) {
  return request({
    url: 'backe_finance_order_every_month_pay',
    method: 'post',
    data
  })
}

export function getMerchantSettleByMonth() {
  return request({
    url: '/finance/getMerchantSettleByMonth',
    method: 'get'
  })
}
/**
 * 客户台账列表
 */
export function financeOrderList(data) {
  return request({
    url: 'backe_finance_list',
    method: 'post',
    data
  })
}
/**
 * 获取地区
 */
export function getRegion(data) {
  return request({
    url: 'get_region',
    method: 'post',
    data
  })
}
export function exceloutfinance(data) {
  return request({
    url: './excel_finance',
    method: 'post',
    data
  })
}

export function excelFen(data) {
  return request({
    url: './excelFen',
    method: 'post',
    data
  })
}
export function exceloutmediate(data) {
  return request({
    url: './mediate_excel',
    method: 'post',
    data
  })
}
export function exceloutserver(data) {
  return request({
    url: './server_excel',
    method: 'post',
    data
  })
}
export function paymentList(data) {
  return request({
    url: 'backe_finance_paymentlist',
    method: 'post',
    data
  })
}
export function paymentEditMediate(data) {
  return request({
    url: 'backe_finance_payment_edit_mediate',
    method: 'post',
    data
  })
}
export function paymentEdit(data) {
  return request({
    url: 'backe_finance_payment_edit',
    method: 'post',
    data
  })
}
export function getMerchantFirst(data) {
  return request({
    url: 'backe_finance_order_finance_first',
    method: 'post',
    data
  })
}
export function channelSubmit(data) {
  return request({
    url: 'backe_finance_order_finance_first_channel',
    method: 'post',
    data
  })
}
// export function updateFirstSubmit(data) {
//   return request({
//     url: 'backe_update_first',
//     method: 'post',
//     data
//   })
// }
export function paymentMerchantEdit(data) {
  return request({
    url: 'backe_finance_order_finance_first_submmit',
    method: 'post',
    data
  })
}
export function getOverdueNumShow(data) {
  return request({
    url: '/payment/getOverdueNumShow',
    method: 'post',
    data
  })
}
export function merchantFirstExcelout(data) {
  return request({
    url: './excel_merchant_first',
    method: 'post',
    data
  })
}
export function merchantDayPayment(data) {
  return request({
    url: 'backe_finance_order_every_month_pay_detail',
    method: 'post',
    data
  })
}
export function toBond(data) {
  return request({
    url: '/finance/toBond',
    method: 'post',
    data
  })
}
export function returnOrderSubmit(data) {
  return request({
    url: 'backe_finance_order_return',
    method: 'post',
    data
  })
}
export function getPayWay() {
  return request({
    url: 'backe_finance_get_payway',
    method: 'get'
  })
}
export function serverMoneySubmit(data) {
  return request({
    url: 'backe_finance_order_server_money',
    method: 'post',
    data
  })
}
export function descSubmit(data) {
  return request({
    url: 'backe_finance_order_desc',
    method: 'post',
    data
  })
}
export function merchantdayexcelout(data) {
  return request({
    url: './merchantdayexcelout',
    method: 'post',
    data
  })
}
export function exceloutday(data) {
  return request({
    url: './excel_finance_day',
    // url: 'http://192.168.31.49:90/excel_finance_day',
    method: 'post',
    data
  })
}
/**
 * 导出成本
 */
export function exceloutprofit(data) {
  return request({
    url: 'excel_profit',
    // url: 'http://192.168.31.47:90/excel_profit',
    method: 'post',
    data
  })
}
// 下载合同
export function downloadContract(data) {
  return request({
    url: './esign_download_signed_contract',
    method: 'post',
    data
  })
}



/**
 * 主数据
 */
export function getMainDatas(data) {
  return request({
    url: '/backend_index_main_data',
    method: 'post',
    data
  })
}
//城市排名
export function cityRank(data) {
  return request({
    url: '/backend_index_city_rank',
    method: 'post',
    data
  })
}
//商户排名
export function merchantRank(data) {
  return request({
    url: '/backend_index_merchant_rank',
    method: 'post',
    data
  })
}
// 销售排名
export function saleRank(data) {
  return request({
    url: '/backend_index_sale_rank ',
    method: 'post',
    data
  })
}
export function saleRankNew(data) {
  return request({
    url: '/finance/saleRankNew',
    method: 'post',
    data
  })
}
export function CityMerchant(data) {
  return request({
    url: '/finance/CityMerchant',
    method: 'post',
    data
  })
}
export function saleRankGroup(data) {
  return request({
    url: '/finance/saleRankGroup',
    method: 'post',
    data
  })
}
/**
 * 客户成本录入
 */
export function costSubmit(data) {
  return request({
    url: '/backend_book_customer_cost_add',
    method: 'post',
    data
  })
}
export function beforeOperation(order_id) {
  return request({
    url: 'http://qrcode.xingruishiguang.com/esign_face?order_id=' + order_id,
    method: 'get'
  })
}
export function insertMediate(data) {
  return request({
    url: 'backend_insert_mediate',
    method: 'post',
    data
  })
}
export function importList(data) {
  return request({
    url: '/finance/importList',
    method: 'post',
    data
  })
}
export function descriptionSubmit(data) {
  return request({
    url: '/finance/descriptionSubmit',
    method: 'post',
    data
  })
}
// 服务费统计
export function serviceList(data) {
  return request({
    url: 'backe_finance_order_server_list',
    method: 'post',
    data
  })
}
export function serverAllMoneySubmit(data) {
  return request({
    url: 'backe_finance_order_server_insert',
    method: 'post',
    data
  })
}
// 居间服务费统计
export function serviceMediateList(data) {
  return request({
    url: 'backe_finance_order_mediateserver_list',
    method: 'post',
    data
  })
}
export function serverMediateAllMoneySubmit(data) {
  return request({
    url: 'backe_finance_order_mediateserver_insert',
    method: 'post',
    data
  })
}
export function backendgetmerchantregion(data) {
  return request({
    url: 'backend_get_merchant_region',
    method: 'post',
    data
  })
}